package com.tisson.bo;


import java.util.ArrayList;
import java.util.List;

import com.tisson.dao.AcDoorDAO;
import com.tisson.pojo.AcDoor;

public class DoorBO {

	public void delete(AcDoor door){
		try{
			AcDoorDAO dao = new AcDoorDAO();
			dao.delete(door);
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	
	public void add(AcDoor door){
		try{
			AcDoorDAO dao = new AcDoorDAO();
			dao.save(door);
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	
	public AcDoor findById(String id){
		try{
			AcDoorDAO dao = new AcDoorDAO();
			return dao.findById(id);
		}catch(Exception e){
			e.printStackTrace();
			return new AcDoor();
		}
	}
	
	public List findByBuildingId(String id){
		List doorList = new ArrayList();
		try{
			AcDoorDAO dao = new AcDoorDAO();
			doorList = dao.findByBuildingId(id);
			return doorList;
		}catch(Exception e){
			e.printStackTrace();
			return new ArrayList();
		}
	}
	
	public void update(AcDoor door){
		try{
			AcDoorDAO dao = new AcDoorDAO();
			dao.update(door);
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
